<template>
  <el-header height="50px" class="top-bar-header">
    <span>{{ title }}</span>
    <span
      title="群聊信息"
      v-show="isGroup"
      class="btn-side el-icon-more"
      @click="setSideStatus"
    >
      <el-icon><More /></el-icon>
    </span>
  </el-header>
</template>

<script setup lang="ts">
import { More } from "@element-plus/icons-vue";
const props = defineProps({
  chat: { type: Object } as any,
  groupMembers: { type: Array } as any,
});
const emits = defineEmits(["setSideStatus"]);
const title = computed(() => {
  let title = props.chat.showName;
  if (props.chat && props.chat.type == "GROUP") {
    let size = props.groupMembers.filter((m: any) => !m.quit).length;
    title += `(${size})`;
  }
  return title;
});
function setSideStatus() {
  emits("setSideStatus");
}
const isGroup = computed(() => {
  return props.chat && props.chat.type == "GROUP";
});
</script>

<style lang="scss" scoped>
// .top-bar-header {
//   width: 100%;
// }
.el-header {
  display: flex;
  justify-content: space-between;
  padding: 0 12px;
  line-height: 50px;
  font-size: var(--im-font-size-larger);
  border-bottom: var(--im-border);

  .btn-side {
    position: absolute;
    right: 20px;
    line-height: 50px;
    font-size: 20px;
    cursor: pointer;
    color: var(--im-text-color-light);
  }
}
</style>
